<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="template.xhtml">
	<ui:define name="content">
	
		<f:metadata>  
		    <f:viewParam name="elementId" value="#{flightBean.flightId}" />  
		</f:metadata>

		<h2>Modifica Volo"</h2>

		<h:form>
			<p:panelGrid columns="2">
				<f:facet name="header">  
		        	Modifica elemento 
		    	</f:facet>
		    	
		    	<h:outputLabel value="Aeroporto di partenza:" /> 
		    	<p:selectOneMenu value="#{flightBean.flight.airport1Id}" effect="fold">  
		            <f:selectItems var="air1" value="#{airportBean.allAirports}" itemLabel="#{air1.name} (#{air1.location.name})" itemValue="#{air1.id}" />  
		            <p:column>  
		                #{air1.name} (#{air1.location.name})
		            </p:column> 
		        </p:selectOneMenu>
		        
		        <h:outputLabel value="Aeroporto di arrivo:" /> 
		    	<p:selectOneMenu value="#{flightBean.flight.airport2Id}" effect="fold">  
		            <f:selectItems var="air2" value="#{airportBean.allAirports}" itemLabel="#{air2.name} (#{air2.location.name})" itemValue="#{air2.id}" />  
		            <p:column>  
		                #{air2.name} (#{air2.location.name})
		            </p:column> 
		        </p:selectOneMenu>
		    	
		    	<h:outputLabel value="Data e ora partenza:" />
		    	<p:calendar value="#{flightBean.flight.departureTime}" pattern="dd/MM/yyyy HH:mm" />
		    	
		    	<h:outputLabel value="Data e ora arrivo:" />
		    	<p:calendar value="#{flightBean.flight.landingTime}" pattern="dd/MM/yyyy HH:mm" />
		    	
		    	<h:outputLabel value="Prezzo:" />  
		    	<p:inputTextarea rows="1" value="#{flightBean.flight.price}"></p:inputTextarea>
		    	
		    	<h:outputLabel value="Posti disponibili:" />  
		    	<p:inputTextarea rows="1" value="#{flightBean.flight.remaining}"></p:inputTextarea>
		    	
		    	<h:outputLabel value="Compagnia:" />  
		    	<p:inputTextarea rows="1" value="#{flightBean.flight.company}"></p:inputTextarea>
		    	
		    	<f:facet name="footer"> 
		    	
		    		<center>
		    			<p:button outcome="manageFlights" value="Annulla" />
		    			<p:commandButton value="Salva" action="#{flightBean.updateFlight}">
		    		</p:commandButton></center>
		    	
		    	</f:facet>
			
			</p:panelGrid>
			</h:form>
			<br />
			<p:messages showDetail="true" autoUpdate="true" closable="true" />

	</ui:define>
</ui:composition>
</html>